<template>
  <view class="index">
    <Banner :imgs="detail.imgs" />
    <Detail :car="detail" />
    <view class="bottom-btn">
      <button @tap="contactPhone">电话联系</button>
    </view>
  </view>
</template>

<script>
import Banner from '@components/self/detail/banner'
import Detail from '@components/self/detail/detail'
// import { getCurrentInstance } from "@tarojs/taro";
import { getSelfDetail } from '@requests/car'
import { call, getParam } from '@utils/index'

export default {
  name: 'ProsuctDetail',
  data() {
    return {
      detail: {},
      imgList: []
    }
  },
  components: {
    Banner,
    Detail
  },
  computed: {},
  created() {
    this.getDetail()
  },
  onShareAppMessage() {
    return {
      title: '亿车商优质车源，低价优选'
    }
  },
  methods: {
    contactPhone() {
      call(this.detail.contact_mobile)
    },
    getDetail() {
      getSelfDetail(getParam('id')).then(res => {
        this.detail = res.result
      })
    }
  }
}
</script>

<style>
.bottom-btn {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.625rem 0.8rem;
  background: #fff;
  z-index: 99;
}
.bottom-btn button {
  width: 100%;
  background-color: #fff;
  border: 2px solid #006cff;
  border-radius: 12px;
  color: #006cff;
  font-size: 1.02rem;
}
</style>
